package es.gesfutbol.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.ui.ModelMap;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import es.gesfutbol.dao.IPenyaDao;
import es.gesfutbol.domini.implementacio.Penya;

public class DirectorioPenyaController extends MultiActionController {

	
	private IPenyaDao penyaDao;

	public IPenyaDao getPenyaDao() {
		return penyaDao;
	}

	public void setPenyaDao(IPenyaDao penyaDao) {
		this.penyaDao = penyaDao;
	}
	
	public ModelAndView init (HttpServletRequest request,
			HttpServletResponse response){
		
		List<Penya> penyas = penyaDao.findAllDirectorioPenyas(); 
		
		ModelMap model = new ModelMap();
		model.addAttribute("llistaPenyas", penyas);
		return new ModelAndView("usuari/directorioPenyas", model);
	}
}
